package com.blb.day20231116redis.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.blb.day20231116redis.pojo.Score;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface ScoreMapper extends BaseMapper<Score> {

    @Results(id = "scoreMap",value = {
            @Result(id = true,property = "id",column = "id"),
            @Result(property = "studentId",column = "student_id"),
            @Result(property = "score",column = "score"),
            @Result(property = "course",column = "course"),
            @Result(property = "student",column = "student_id",
                    one = @One(select = "com.blb.day20231116redis.mapper.StudentMapper.selectById"))
    })
    @Select("select * from t_score")
    List<Score> selectAll();

    @ResultMap("scoreMap")
    @Select("select * from t_score")
    IPage<Score> selectScorePage(IPage<Score> page);
}
